<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="这是一个 adminInfoAdd 页面">
<meta name="keywords" content="adminInfoAdd">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<meta name="apple-mobile-web-app-title" content="Amaze UI" />
<title>新增管理员</title>
    
<link rel="stylesheet" type="text/css"href="static/bootstrap-3.3.7-dist/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css"href="static/bootstrap-3.3.7-dist/css/bootstrap-theme.min.css" />
<link href="static/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet" media="screen">
<link rel="icon" type="image/png" href="${basePath}static/adminManager/assets/i/favicon.png">
<link rel="apple-touch-icon-precomposed" href="${basePath}static/adminManager/assets/i/app-icon72x72@2x.png">
<link rel="stylesheet" href="${basePath}static/adminManager/assets/css/amazeui.min.css" />
<link rel="stylesheet" href="${basePath}static/adminManager/assets/css/admin.css">
<link rel="stylesheet" href="${basePath}static/adminManager/add/css/add.css">

</head>

<body>

	<div class="admin-biaogelist">
	
   		<div class="listbiaoti am-cf">
      		<ul class="am-icon-flag on"> 管理员新增</ul>
      		<dl class="am-icon-home" style="float: right;">当前位置： 首页 > <a href="#">管理员新增</a></dl>
    	</div>
    	
<div class="am-g tpl-g" >
	<div class="tpl-login">
		<div class="tpl-login-content">
		
			<form   id="form0" class="form-horizontal"  action="AdminInfoAddWithFile" enctype="multipart/form-data"  method="post">
				
				<div  class="registe-content">
					
					<div class="bootint">
						<span class="input-span-text ">姓名</span>
						<input type="text" class="form-control3" id="adminname"
							name="adminname" placeholder="请输入用户名（4-8位非空字符）">
					</div>
				
					<div class="bootint">
						<span class="input-span-text ">密码</span>
						<input type="password" class="form-control3" id="adminpsw"name="adminpsw" 
							placeholder="请输入密码（8-16位非空字符）">
					</div>
				
					<div class="bootint">
						<span class="input-span-text ">确认密码</span>
						<input type="password" class="form-control3" id="adminpsw2"name="adminpsw2" 
							placeholder="请再次输入密码（与第一次输入的密码一致）">
					</div>
				
					<!-- 还没实现
					<div class="bootint">
						<span class="input-span-text ">性别</span>
						<input type="radio" id="male" name="usersex" value="男" style="margin:12px 0px 12px 60px"/>男 
						<input type="radio" id="female" name="usersex" value="女"style="margin:12px 0px 12px 60px" />女
					</div>
					 -->
				
					<div class="bootint">
						<span class="input-span-text ">居住地</span>
						<input type="text" class="form-control3"  id="adminaddress" name="adminaddress" 
							placeholder="请输入居住地">
					</div>
				
					<div class="bootint">
						<span class="input-span-text ">手机号</span>
						<input type="text" class="form-control3" id="admintel"name="admintel" 
							placeholder="请输入联系电话">
					</div>
					
					<!-- 
					<div class="bootint">
						<span class="input-span-text ">注册日期</span>
						<input type="date" class="form-control3 " id="regdate" name="regdate"
							placeholder="">
					</div>
					 -->
					
					<div class="bootint">
						<!-- 因为springmvc框架中，文件流对象，需要单独进行映射，不能直接映射给实体类；
							所有，文件表单控件name属性按一下规范命名：前缀_实体类属性名；
							例如：file_adminimg（注意file_在文件上传时是固定的） 
							目的：防止文件流对象内容直接映射给实体类的属性-->
						<span class="input-span-text ">头像</span>	
						<input type="file" class="form-control3" id="adminimg"name="file_adminimg" > 
					</div>
				
					<div class="bootint" style="margin-bottom:30px">
						<button type="submit" class="btn btn-success btn-lg"  id="rebtn"onclick="return checkMe()">提交</button>
						<button type="reset" class="btn btn-info btn-lg" style="float:right">重置</button>	
					</div>
			
			
				</div>
			
        	</form>
            
		</div>
	</div>
 </div>


</div>
    
    

<script type="text/javascript" src="static/jquery-1.12.4/jquery-1.12.4.min.js"></script>
<script type="text/javascript" src="static/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="static/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js" charset="UTF-8"></script>
<script type="text/javascript" src="static/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.fr.js" charset="UTF-8"></script>    
<script type="text/javascript" src="static/layer-v3.1.1/layer/layer.js"></script>
<script type="text/javascript" src="static/layui-v2.4.5/layui/layui.js"></script>
<script type="text/javascript">
	 // 验证form表单是否合法
	function checkMe() {
		// 错误提示信息
		var strMsg = "";
		// 用户昵称验证
		//var regName = /^.\S{3,7}$/;
		var username = document.getElementById("adminname").value;
		if (username == null || username == ""
				|| regName.test(username) === false) {
			// 增加提示信息
			strMsg += "请输入正确的用户名!<br>";
		}
		// 密码验证
		//var regPsw = /^.[A-z0-9]{7,15}$/;
		var userpsw = document.getElementById("adminpsw").value;
		if (userpsw == null || userpsw == "" || regPsw.test(userpsw) === false) {
			// 增加提示信息
			strMsg += "请输入正确格式的密码!<br>";
		}
		var userpsw2 = document.getElementById("adminpsw2").value;
		if (userpsw != userpsw2) {
			// 增加提示信息
			strMsg += "两次密码不一致！";
		}
		// 居住地验证
		var userlocation = document.getElementById("adminaddress").value;
		if (userlocation == null || userlocation == "") {
			// 增加提示信息
			strMsg += "请输入居住地 !<br>";
		}
		// 手机号验证
		var regModile = /^1\d{10}$/;
		var usertel = document.getElementById("admintel").value;
		if (usertel == null || usertel == ""	|| regModile.test(usertel) === false) {
			// 增加提示信息
			strMsg += "请输入正确的手机号!<br>";
		}
		
		// 判定整个表单是否可以进行提交
		if (strMsg == "") {
			// 验证通过
			return true;
		} else {
			// 验证不通过
			layer.open({
				icon:2,
				title : '提示',
				content : strMsg
			});
			return false;
		}
	}
	// 手动提交form表单
	function doSubmit() {
		document.getElementById("form0").submit();
	}
</script>


<!-- 管理权限的确认，管理密码正确则打开页面，管理密码错误则阻拦并返回欢迎页 -->
<script>
	layui.use(['layer'],function(){
		layer.prompt({
			formType:1,
			title:'请输入管理密码',
			maxlength:140,
			cancel: function() {//右上角关闭按钮绑定的事件
				layer.msg('放弃操作');
		        window.location.href="${basePath}jump?pg=welcome"; 
		    },btn2: function() {//取消按钮绑定的事件
		        layer.msg('放弃操作');
		        window.location.href="${basePath}jump?pg=welcome"; 
		    }
		},function(value,index,elem){
			//alert(value);
			if(value=="chen1869"){
				layer.msg("密码正确！");
				layer.close(index);
			}else{
				lay.msg("密码错误！");
				//history.go(-2);
				window.location.href="${basePath}jump?pg=welcome"; 
			}	
		});
	});
</script>
</body>


</html>